package com.zang.blogz.controller;

import com.zang.blogz.handler.ZVerifyWebSocketHandler;
import com.zang.blogz.model.input.ro.VoiceRO;
import com.zang.blogz.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 朵橙i
 * @since 2022-06-17
 */
@RestController
@RequestMapping("/blogz/chatRecord")
@Api(tags = "语音发送")
public class ChatRecordController {

    @Autowired
    private ZVerifyWebSocketHandler zVerifyWebSocketHandler;

    /**
     * 保存语音信息
     *
     * @param voiceVO 语音信息
     * @return {@link Result<String>} 语音地址
     */
    @ApiOperation(value = "上传语音")
    @PostMapping("/admin/voice")
    public Result<String> sendVoice(VoiceRO voiceVO) {
        zVerifyWebSocketHandler.sendVoice(voiceVO);
        return Result.ok();
    }

}
